package firstjob;

import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author yue.cao
 * @since 09-23-2020
 */
@Slf4j
public class HelloWorld {


	public static void main(String[] args) throws Exception {
		log.warn("========Are You Ready=====3=======");
		log.warn("========Are You Ready=====2=======");
		log.warn("========Are You Ready=====1=======");
		log.error("========START====================");
		StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
		DataStreamSource<String> source = env.fromCollection(Lists.newArrayList("hello", "word"));
		source.map(new MapFunction<String, String>() {
			@Override
			public String map(String s) throws Exception {
				return "[" + s + "]";
			}
		}).setParallelism(1).print().setParallelism(1);
		env.execute(HelloWorld.class.getName());
	}
}
